(mode-line-change-eol): Add EVENT parameter.
authorJohn Paul Wallington <jpw@pobox.com>
Sat, 10 Jan 2004 01:19:53 +0000 (01:19 +0000)
committerJohn Paul Wallington <jpw@pobox.com>
Sat, 10 Jan 2004 01:19:53 +0000 (01:19 +0000)
Temporarily select EVENT's window for changing eol type.

lisp/bindings.el

index ed4da745b2da48b8ea27c3b045eb895a325f0638..1f86f3b6fcb67e4bff99d63ae4b6d2b859152dae 100644 (file)
@@ -135,12 +135,14 @@ corresponding to the mode line clicked."
   "Local keymap for the coding-system part of the mode line.")
 
 
-(defun mode-line-change-eol ()
+(defun mode-line-change-eol (event)
   "Cycle through the various possible kinds of end-of-line styles."
-  (interactive)
-  (let ((eol (coding-system-eol-type buffer-file-coding-system)))
-    (set-buffer-file-coding-system
-     (cond ((eq eol 0) 'dos) ((eq eol 1) 'mac) (t 'unix)))))
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (let ((eol (coding-system-eol-type buffer-file-coding-system)))
+      (set-buffer-file-coding-system
+       (cond ((eq eol 0) 'dos) ((eq eol 1) 'mac) (t 'unix))))))
 
 (defvar mode-line-eol-desc-cache nil)